import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout.vue'
import Home from '@/views/home.vue'
import News from '@/views/news.vue'
import Sun from '@/views/sun/sun.vue'
import User from '@/views/user.vue'
import City from '@/views/city.vue'
import House from '@/views/sun/house-box.vue'
import Map from '@/views/map.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      { path: 'home', component: Home },
      { path: 'sun', component: Sun },
      { path: 'news', component: News },
      { path: 'user', component: User }
    ]
  },
  {
    path: '/city',
    component: City
  },
  {
    path: '/details/:id',
    component: House
  },
  {
    path: '/map',
    component: Map
  }
]

const router = new VueRouter({
  routes
})

export default router
